<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" dir="ltr">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="tools.js"></script>
    <script type="text/javascript">
      function calculateAfter(){
        var txtPreTax = document.getElementById("txtPreTax");
        var sTax = document.getElementById("sTax");
        var sAfterTax = document.getElementById("sAfterTax");
        if(txtPreTax.value != ""){
            var tax = new afterTaxSalary(txtPreTax.value);
            sTax.innerHTML = tax.tax.toFixed(2);
            sAfterTax.innerHTML = tax.afterTax.toFixed(2);
        }

      }
       function calculatePre(){
        var txtAfterTax = document.getElementById("txtAfterTax");
        var sTax = document.getElementById("sTax1");
        var sPreTax = document.getElementById("sPreTax");
        if(txtAfterTax.value != ""){
            var tax = new preTaxSalary(txtAfterTax.value);
            sTax.innerHTML = tax.tax.toFixed(2);
            sPreTax.innerHTML = tax.preTax.toFixed(2);
        }

      }
    </script>
    <title>JS测试页面</title>
</head>
<body>
    <div>
    <ul>
        <li>个税起征点:2000</li>
        <li> 税前月薪:<input type="text" id="txtPreTax"  /></li>
        <li> 应缴个税:<span id="sTax"></span></li>
        <li>税后月薪:<span id="sAfterTax"></span></li>
        <li><input type="button" onclick="calculateAfter()" value="计算税后工资" /></li>
    </ul>
     <ul>
        <li>个税起征点:2000</li>
        <li> 税后月薪:<input type="text" id="txtAfterTax"  /></li>
        <li>应缴个税:<span id="sTax1"></span></li>
        <li>税前月薪:<span id="sPreTax"></span></li>
        <li><input type="button" onclick="calculatePre()" value="计算税前工资" /></li>
    </ul>
    </div>
</body>
</html>